import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Header from '@/components/Header'
import Footer from '@/components/Footer'

import Home from '@/pages/Home'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Search from '@/pages/Search'
Vue.use(Router)

const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}


export default new Router({
  routes: [
  
    {
      path: '/header',
      name: 'Header',
      component: Header,
      meta:{show:true}
    },
    {
      path: '/Footer',
      name: 'Footer',
      component: Footer,
      meta:{show:true}
    }
    ,
    {
      path: '/Home',
      name: 'Home',
      component: Home,
      meta:{show:true}
    }
    ,
    {
      path: '/Login',
      name: 'Login',
      component: Login,
      meta:{show:true}
    }
    ,
    {
      path: '/Register',
      name: 'Register',
      component: Register,
      meta:{show:false}
    }
    ,
    {
      path: '/Search/:keyword',
      name: 'Search',
      component: Search,
      meta:{show:true}
    },
    {
      path: "/*",
      redirect:"/Home",
      meta:{show:true}
    }
  ]
})


